package com.mdmedia.common.test;  
  
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
  
@Controller
@RequestMapping("/test")
public class Hello {
	
	Logger logger = LoggerFactory.getLogger(Hello.class);
	
	@RequestMapping("freeMarker")
    public String testFree(Model model){  
        model.addAttribute("message","Hello World!!!Freemarker");  
        return "HelloWorld";  
    }
	
	@RequestMapping("{requestname}")
    public String HelloWorld(@PathVariable String requestname, Model model){  
        model.addAttribute("message","Hello World!!!"+requestname);
        CommonDataAssist assist = new CommonDataAssist();
        model.addAttribute("name",assist.getName());
        model.addAttribute("assist",assist);
        return "test";  
    }
	
	@RequestMapping("/logback")
    public String testLogback(Model model){  
		try {
			throw new Exception();
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("logback Test", e);
		}
        return "HelloWorld";  
    }
      
}  